package com.itheima.dubbo.mysql.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.itheima.commons.pojo.Question;
import com.itheima.dubbo.interfaces.QuestionApi;
import com.itheima.dubbo.mysql.mapper.QuestionMapper;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @项目名称: tanhua-53
 * @包名: com.itheima.dubbo.mysql.impl
 * @作者: 李云飞
 * @日期: 2021-12-03
 */
@Service
public class QuestionApiImpl implements QuestionApi {

    @Autowired
    private QuestionMapper questionMapper;


    @Override
    public Question findQuestionByUserId(Long userId) {
        Question question = questionMapper.selectOne(Wrappers.lambdaQuery(Question.class)
                .eq(Question::getUserId, userId));
        return question;
    }
}
